//package com.example.demo.service;
//
//import com.example.demo.entity.Student;
//import com.example.demo.mapper.StudentMapper;
//import com.example.demo.mapper.StudentMapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class StudentService {
//    @Autowired
//    private StudentMapper studentMapper;
//
//    public Student findById(Integer id) {
//        return studentMapper.findById(id).get();
//    }
//    public Student addStudent(String name,Integer age) {
//        Student student = new Student();
//        student.setName(name);
//        student.setAge(age);
//        return studentMapper.save(student);
//    }
//    public Student updateStudent(Integer id,String name,Integer age) {
//        Student student = new Student();
//        student.setId(id);
//        student.setName(name);
//        student.setAge(age);
//        return studentMapper.save(student);
//    }
//    public void deleteStudentById(Integer id) {
//        if (studentMapper.existsById(id))
//            studentMapper.deleteById(id);
//    }
//
//    public List<Student> findAll() {
//        return studentMapper.findAll();
//    }
//
//
//}
